package chapter01

object Test23_While4 {
  def main(args: Array[String]): Unit = {
    scala.util.control.Breaks.breakable{
      while(true){
        println("请输入你的性别：")
        val sex = scala.io.StdIn.readLine()
        if(sex=="男"){
          println("向左走")
          scala.util.control.Breaks.break
        }else if(sex=="女"){
          println("向右走")
          scala.util.control.Breaks.break
        }else{
          println("输入有误，请重新输入性别")
        }
      }
    }

  }
}
